package com.atguigu.reflect.testmethod;

import com.atguigu.reflect.testmethod.Person;


import java.lang.reflect.Method;


public class TestMain {
    public static void main(String[] args) throws Exception {
        //获取Person对应的Class
        Class clazz = Person.class;
        Person p = (Person)clazz.newInstance();
        //通过clazz获取其中的方法
        Method m = clazz.getDeclaredMethod("testPrivate");
        System.out.println(m.getName());
        m.setAccessible(true);
        m.invoke(p);


    }
}
